import Vue from 'vue'
import VueI18n from 'vue-i18n'

import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import ElementLocale from 'element-ui/lib/locale'
import zhLang from './zh'
import enLang from './en'

Vue.use(VueI18n)

const messages = {
  en: {
    ...enLocale,
    ...enLang
  },
  zh: {
    ...zhLocale,
    ...zhLang
  }
}
const i18n = new VueI18n({
  locale: 'en', // set locale
  messages // set locale messages
})

ElementLocale.i18n((key, value) => i18n.t(key, value))
// 必须导出,再在main.js中进行全局挂载
export default i18n
